/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.risk.control.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hopes.bizz.risk.common.constant.enums.RiskModDictEnum;
import com.hopes.bizz.risk.common.constant.enums.RiskSysDictEnum;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.common.entity.BaseLogicEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 风险管控措施
 *
 * @author pig
 * @date 2023-07-19 16:16:03
 */
@Data
@TableName("risk_control_measure")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "风险管控措施")
public class RiskControlMeasureEntity extends BaseLogicEntity {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "id")
    private Long id;
    /**
     * uid
     */
    @Schema(description = "id")
    private String uid;

    /**
     * 风险单元标识
     */
    @Schema(description = "风险单元标识")
    private Long riskUnitId;

    /**
     * 风险事件ID
     */
    @Schema(description = "风险事件ID")
    @NotNull(message = "风险事件不可为空")
    private Long riskEventId;

    /**
     * 管控方式
     */
    @Schema(description = "管控方式")
    @NotNull(message = "管控方式不可为空")
    private Integer controlType;

    /**
     * 管控层级
     */
    @Schema(description = "管控层级")
    @NotNull(message = "管控层级不可为空")
    private Integer controlLevel;

    /**
     * 管控措施分类1
     */
    @Schema(description = "管控措施分类1")
    @NotBlank(message = "管控措施分类1不可为空")
    @Length(max = 20, message = "管控措施分类1最大长度为：20")
    private String classify1;

    /**
     * 管控措施分类2
     */
    @Schema(description = "管控措施分类2")
    @NotBlank(message = "管控措施分类2不可为空")
    @Length(max = 20, message = "管控措施分类2最大长度为：20")
    private String classify2;

    /**
     * 管控措施分类3
     */
    @Schema(description = "管控措施分类3")
    private String classify3;

    /**
     * 管控措施描述
     */
    @Schema(description = "管控措施描述")
    @NotBlank(message = "管控措施描述为必填项")
    @Length(max = 2000, message = "管控措施描述最大长度为:2000")
    private String riskMeasureDesc;

    /**
     * 隐患排查内容
     */
    @Schema(description = "隐患排查内容")
    @NotBlank(message = "隐患排查内容为必填项")
    private String checkContent;

    /**
     * 相关法规标准
     */
    @Schema(description = "相关法规标准")
    @Length(max = 100, message = "相关法规标准最大长度为:100")
    private String lawDesc;

    /**
     * 落实情况
     */
    @Schema(description = "落实情况")
    @Length(max = 1000, message = "落实情况最大长度为:1000")
    private String executeDesc;

    /**
     * 排序序号
     */
    @Schema(description = "排序序号")
    private Integer orderSort;

    /**
     * 机构ID
     */
    @Schema(description = "机构ID")
    private Long orgId;


    public String getRiskUnitIdStr() {
        return DictResolver.getItemLabelByValue(RiskModDictEnum.risk_unit, this.riskUnitId);
    }

    public String getRiskEventIdStr() {
        return DictResolver.getItemLabelByValue(RiskModDictEnum.risk_unit_event, this.riskEventId);
    }

    public String getControlTypeStr() {
        return DictResolver.getItemLabelByValue(RiskSysDictEnum.risk_control_type, this.controlType);
    }

    public String getControlLevelStr() {
        return DictResolver.getItemLabelByValue(RiskSysDictEnum.risk_control_level, this.controlLevel);
    }

    public String getClassify1Str() {
        return DictResolver.getItemLabelByValue(RiskSysDictEnum.risk_control_classify, this.classify1);
    }

    public String getClassify2Str() {
        return DictResolver.getItemLabelByValue(RiskSysDictEnum.risk_control_classify, this.classify2);
    }
}
